<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
      <?php
        if(isset($_FILES['myfile']) && !empty($_FILES['myfile'])){
            $total = count($_FILES['myfile']['name']);

            for ($i = 0; $i < $total; $i++) {
                $tmpFilePath = $_FILES['myfile']['tmp_name'][$i];
                if ($tmpFilePath != ""){
                    // 设置文件上传路径
                    $newFilePath = "./upload/" . $_FILES['myfile']['name'][$i];

                    // 上传文件
                    if(move_uploaded_file($tmpFilePath, $newFilePath)) {
                        echo "文件上传成功。<br>";
                    } else {
                        echo "文件上传失败。<br>";
                    }
                }
            }
        } else {
            echo "没有文件上传。";
        }
?>
    </body>
</html>
